import 'package:book_app/feature/category/view/category_page_view.dart';
import 'package:book_app/feature/favorite/view/favorite_view.dart';
import 'package:book_app/feature/home/view/book_home_view.dart';
import 'package:book_app/feature/search/view/book_search_view.dart';
import 'package:book_app/product/constants/app_colors.dart';
import 'package:book_app/product/constants/app_strings.dart';
import 'package:flutter/material.dart';

class MainPage extends StatefulWidget {
  const MainPage({super.key});

  @override
  State<MainPage> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  int currentPage = 0;
  final pages = [
    const BookHomeView(),
    const BookCategoryView(),
    const FavoriteBooksView(),
    const BookSearchView(),
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: pages[currentPage],
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: AppColors.white,
        selectedItemColor: AppColors.orange,
        unselectedItemColor: AppColors.text96A,
        unselectedLabelStyle: TextStyle(
          color: AppColors.text96A,
        ),
        // unselectedIconTheme: IconThemeData(
        //   color: AppColors.darkGrey,
        // ),
        // selectedIconTheme: IconThemeData(
        //   color: AppColors.green,
        //   size: 30,
        // ),
        currentIndex: currentPage,
        elevation: 5,
        type: BottomNavigationBarType.fixed,
        onTap: (index) {
          setState(() {
            currentPage = index;
          });
        },
        items: const [
          BottomNavigationBarItem(
            icon: Image(image: AssetImage('assets/images/home.png'),width: 25,height: 25),
            activeIcon: Image(image:AssetImage('assets/images/homeselect.png'),width: 25,height: 25),
            label: AppStrings.homeLabel,
          ),
          BottomNavigationBarItem(
            icon: Image(image: AssetImage('assets/images/mine.png'),width: 25,height: 25),
            activeIcon: Image(image: AssetImage('assets/images/mineselect.png'),width: 25,height: 25),
            label: AppStrings.accountLabel,
          ),
          // BottomNavigationBarItem(
          //   icon: Icon(
          //     Icons.favorite,
          //   ),
          //   label: AppStrings.favoritesLabel,
          // ),
          // BottomNavigationBarItem(
          //   icon: Icon(
          //     Icons.search,
          //   ),
          //   label: AppStrings.searchLabel,
          // ),
        ],
      ),
    );
  }
}
